//
//  WQMySelectRedCell.m
//  WisdomQuestor
//
//  Created by 纪景城 on 2024/12/19.
//

#import "WQMySelectRedCell.h"

@implementation WQMySelectRedCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.clipsToBounds = YES;
        self.backgroundColor = UIColor.clearColor;
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self.contentView addSubviews:[NSArray arrayWithObjects:self.iconImageView, self.nameLabel, self.redView, self.nextImageView, nil]];
        [self fragmentUI_ViewSet];
    }
    return self;
}

#pragma mark ------- Lazy Methods -------

- (void)fragmentUI_ViewSet {
    [self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView);
        make.left.equalTo(self.contentView.mas_left).offset(kFragmemtFloat(18));
        make.size.mas_equalTo(kSizzleKapadate(19, 19));
    }];
    [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView);
        make.left.equalTo(self.iconImageView.mas_right).offset(kFragmemtFloat(16));
    }];
    [self.nextImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView);
        make.right.equalTo(self.contentView.mas_right).offset(-kFragmemtFloat(22));
        make.size.mas_equalTo(kSizzleKapadate(7, 12));
    }];
    [self.redView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView);
        make.right.equalTo(self.nextImageView.mas_left).offset(-kFragmemtFloat(16));
        make.size.mas_equalTo(kSizzleKapadate(6, 6));
    }];
}

- (UIImageView *)iconImageView {
    if (!_iconImageView) {
        _iconImageView = [[UIImageView alloc] init];
    }
    return _iconImageView;
}

- (UIImageView *)nextImageView {
    if (!_nextImageView) {
        _nextImageView = [[UIImageView alloc] initWithImage:kImageName(@"base_jiantousmall_huise")];
    }
    return _nextImageView;
}

- (UILabel *)nameLabel {
    if (!_nameLabel) {
        _nameLabel = [UILabel initWithTextColor:k_Color_222222 weight:UIFontWeightMedium size:14];
    }
    return _nameLabel;
}

- (UIView *)redView {
    if (!_redView) {
        _redView = [[UIView alloc] init];
        _redView.backgroundColor = k_Color_F14D47;
        _redView.cornerRadius = kFragmemtFloat(3);
        _redView.hidden = YES;
    }
    return _redView;
}

@end
